#ifndef INCL_COMPANY_H
#define INCL_COMPANY_H
/*
 * 原创 by archer 2014.6.5 22:23
 */
#include <vector>
using namespace std;
class Staff
{
public:
    Staff(){};
    virtual ~Staff(){};
    virtual void getInfo()=0;
};

class Leaf :public Staff
{
public:
    Leaf(string name,string position,int salary):name(name),position(position),salary(salary){};
    ~Leaf(){};
    void getInfo()
    {
        cout<<"name: "<<name<<"; position is "<<position<<"; salary is "<<salary<<endl;
        getPInfo();
        //cout<<"======================="<<endl;
    };
    void getPInfo()
    {
        cout<<"touched projects are ";
        for(vector<string>::size_type ix =0;ix<vec_str.size();ix++)
        {
            cout<<vec_str[ix];
        }
    }
    void touchP(string p)
    {
        vec_str.push_back(p);
    };
private:
    string name;
    string position;
    int salary;
    vector<string> vec_str;
};
class Branch :public Staff
{
public:
    Branch(string name,string position,int salary):name(name),position(position),salary(salary){};
    ~Branch(){};
    void add(Staff *s)
    {
        vec.push_back(s);
    };
    void del(Staff *s)
    {

    }
    void getInfo()
    {
        cout<<"name: "<<name<<"; position is "<<position<<"; salary is "<<salary<<endl;
        getPInfo();
        getLeafInfo();
        //cout<<"======================="<<endl;

    };
    void getLeafInfo()
    {
        vector<Staff>::size_type ix;
        for(ix=0;ix<vec.size();ix++)
        {
            vec[ix]->getInfo();
        }
    }
    void touchP(string p)
    {
        vec_str.push_back(p);
    };
    void getPInfo()
    {
        cout<<"touched projects are "<<endl;
        for(vector<string>::size_type iix =0;iix<vec_str.size();iix++)
        {
            cout<<vec_str[iix];
        }
    }

private:
    string name;
    string position;
    int salary;
    vector<Staff *> vec;
    vector<string> vec_str;

};

#endif